//
//  EventTypeHelper.m
//  sy_pad_l
//
//  Created by Chiu Chi Ho on 1/3/13.
//  Copyright (c) 2013 Chiu Chi Ho. All rights reserved.
//

#import "EventTypeHelper.h"

@implementation EventTypeHelper

+ (PADEventType)convertToEventTypeFromString:(NSString *)strType
{
	if([strType isEqualToString:@"meta"])	//Dark
		return kTYPE_DARK;
	else if([strType isEqualToString:@"gol"])	//Light
		return kTYPE_LIGHT;
	else if([strType isEqualToString:@"safa"])	//Water
		return kTYPE_WATER;
	else if([strType isEqualToString:@"ruby"])	//Fire
		return kTYPE_FIRE;
	else if([strType isEqualToString:@"eme"])	//Grass
		return kTYPE_GRASS;
	else if([strType isEqualToString:@"meta2"])	//Super dark
		return kTYPE_SUPER_DARK;
	
	return kTYPE_NIL;
}

+ (NSString *)convertToStringFromEventType:(PADEventType)type
{
	if(type == kTYPE_DARK)
		return @"Dark";
	else if(type == kTYPE_LIGHT)
		return @"Light";
	else if(type == kTYPE_WATER)
		return @"Water";
	else if(type == kTYPE_FIRE)
		return @"Fire";
	else if(type == kTYPE_GRASS)
		return @"Grass";
	else if(type == kTYPE_SUPER_DARK)
		return @"Super Dark";
	
	return @"None";
}

+ (UIColor *)getTextColorByEventType:(PADEventType)type
{
	if(type == kTYPE_SUPER_DARK)
		return [UIColor whiteColor];
	
	return [UIColor blackColor];
}

+ (UIColor *)getBackgroundColorByEventType:(PADEventType)type
{
	CGFloat red = 255.0;
	CGFloat green = 255.0;
	CGFloat blue = 255.0;
	CGFloat alpha = 255.0;
	
	if(type == kTYPE_DARK)
	{
		red = 186;
		green = 187;
		blue = 199;
	}
	else if(type == kTYPE_LIGHT)
	{
		red = 203;
		green = 190;
		blue = 118;
	}
	else if(type == kTYPE_WATER)
	{
		red = 111;
		green = 162;
		blue = 245;
	}
	else if(type == kTYPE_FIRE)
	{
		red = 234;
		green = 116;
		blue = 116;
	}
	else if(type == kTYPE_GRASS)
	{
		red = 106;
		green = 218;
		blue = 157;
	}
	else if(type == kTYPE_SUPER_DARK)
	{
		red = 0;
		green = 0;
		blue = 0;
	}
	
	return [UIColor colorWithRed:red / 255.0 green:green / 255.0 blue:blue / 255.0 alpha:alpha / 255.0];
}
@end
